package org.eden.heartbeat.core.report;

import org.eden.heartbeat.core.persistence.RequestDAO;
import org.eden.heartbeat.core.persistence.SimplePersistenceManager;
import org.eden.heartbeat.core.report.impl.ReportServiceImpl;

/**
 * Object factory for reporting services.
 *
 * @author trsimoes
 * @version $Revision:$
 */
public class ReportServiceFactory {

    private static ReportServiceFactory ourInstance = new ReportServiceFactory();

    private ReportService reportService = null;

    public static ReportServiceFactory getInstance() {
        return ourInstance;
    }

    private ReportServiceFactory() {
    }

    /**
     * Creates a new report service.
     *
     * @return new instance of {@code ReportService}.
     */
    public ReportService getServiceInstance() {

        if (this.reportService == null) {
            RequestDAO requestDAO = SimplePersistenceManager.getInstance().getDaoInstance(RequestDAO.class);
            this.reportService = new ReportServiceImpl(requestDAO);
        }

        return this.reportService;
    }
}
